use super::gd_handler::GdHandler;
use rmcp::{
    ErrorData as McpError, RoleServer, ServerHandler, model::*, service::RequestContext,
    tool_handler,
};

#[tool_handler]
impl ServerHandler for GdHandler {
    async fn initialize(
        &self,
        _request: InitializeRequestParam,
        _context: RequestContext<RoleServer>,
    ) -> Result<InitializeResult, McpError> {
        Ok(self.get_info())
    }

    fn get_info(&self) -> ServerInfo {
        ServerInfo {
            protocol_version: ProtocolVersion::V_2024_11_05,
            capabilities: ServerCapabilities::builder()
                .enable_tools()
                .build(),
            server_info: Implementation {
                name: "rmcp-server-gd".to_string(),
                version: env!("CARGO_PKG_VERSION").to_string(),
            },
            instructions: Some("RMCP gd server providing 3d system remote control tools. Supports device_control (control) tools.".to_string()),
        }
    }
}
